﻿@{
    ViewBag.Title = "首页";
}
@section headerSection{
    <link href="~/Resources/mainFrame/css/bootstrap.min14ed.css" rel="stylesheet" />
    <link href="~/Resources/mainFrame/css/font-awesome.min93e3.css" rel="stylesheet" />
    <link href="~/Resources/mainFrame/css/animate.min.css" rel="stylesheet" />
    <link href="~/Resources/mainFrame/css/style.min862f.css" rel="stylesheet" />

    <style>
        #dataDetail li {
        }

        .ibox-title {
            border-color: #fff;
        }

        td {
            height: 40px;
        }

        body {
            font-family: "微软雅黑";
            font-size: 13px;
        }
    </style>
}
<div class="row border-bottom white-bg dashboard-header">
    <div class="col-sm-12">
        <div class="col-sm-2">
            <div class="widget style1 lazur-bg">
                <div class="row">
                    <div class="col-xs-4">
                        <i class="glyphicon glyphicon-road" style="font-size:50px;"></i>
                    </div>
                    <div class="col-xs-8 text-right">
                        <span> 居委会（村）个数 </span>
                        <h2 class="font-bold"><a href="#" style="color:#fff" onclick="baneCountManager.VillagesCount();">@ViewBag.Villages</a></h2>
                    </div>
                </div>
            </div>
        </div>
        <div class="col-sm-2">
            <div class="widget style1 lazur-bg">
                <div class="row">
                    <div class="col-xs-4">
                        <i class="glyphicon glyphicon-user" style="font-size:50px;"></i>
                    </div>
                    <div class="col-xs-8 text-right">
                        <span> 戒毒/康复 总人数 </span>
                        <h2 class="font-bold"><a href="#" style="color:#fff" onclick="baneCountManager.PersonCount();">@ViewBag.Count</a></h2>
                    </div>
                </div>
            </div>
        </div>
        <div class="col-sm-2">
            <div class="widget style1 lazur-bg">
                <div class="row">
                    <div class="col-xs-4">
                        <i class="glyphicon glyphicon-floppy-remove" style="font-size:50px;"></i>
                    </div>
                    <div class="col-xs-8 text-right">
                        <span> 本月应检人数 </span>
                        <h2 class="font-bold"><a href="#" style="color:#fff" onclick="baneCountManager.MonthCount();">@ViewBag.ShouldCount</a></h2>
                    </div>
                </div>
            </div>
        </div>
        <div class="col-sm-2">
            <div class="widget style1 lazur-bg">
                <div class="row">
                    <div class="col-xs-4">
                        <i class="glyphicon glyphicon-remove" style="font-size:50px;"></i>
                    </div>
                    <div class="col-xs-8 text-right">
                        <span> 本月已检人数 </span>
                        <h2 class="font-bold"><a href="#" style="color:#fff" onclick="baneCountManager.FinishCount();">@ViewBag.FinishCount</a></h2>
                    </div>
                </div>
            </div>
        </div>
        <div class="col-sm-2">
            <div class="widget style1 lazur-bg">
                <div class="row">
                    <div class="col-xs-4">
                        <i class="glyphicon glyphicon-flag" style="font-size:50px;"></i>
                    </div>
                    <div class="col-xs-8 text-right">
                        <span> 已过检测人数 </span>
                        <h2 class="font-bold"><a href="#" style="color:#fff" onclick="baneCountManager.DatedCount();">@ViewBag.PastCount</a></h2>
                    </div>
                </div>
            </div>
        </div>
    </div>

    <div id="dataDetail" class="col-sm-12">
        <div class="col-sm-4">
            <div class="ibox float-e-margins">
                <div class="ibox-title">
                    <h5>待办事宜</h5>
                    <div class="ibox-tools">
                        <span><a class="line">更多</a></span>
                    </div>
                </div>
                <div class="ibox-content no-padding">
                    <ul class="list-group">
                        @{
                            //本月已检
                            if (ViewBag.FinishCount > 0)
                            {
                                <li class="list-group-item">
                                    <span class="badge badge-primary"></span>
                                    <a class="line" title="本月已检" onclick="baneCountManager.FinishCount();">本月已检：(@ViewBag.FinishCount) 人</a>
                                </li>
                            }
                            //即将过检
                            if (ViewBag.UpComming > 0)
                            {
                                <li class="list-group-item">
                                    <span class="badge badge-primary"></span>
                                    <a class="line" title="即将过检" onclick="baneCountManager.WeekCount();">即将过检：(@ViewBag.UpComming) 人</a>
                                </li>
                            }
                            //已过人员
                            if (ViewBag.PastCount > 0)
                            {
                                <li class="list-group-item">
                                    <span class="badge badge-primary"></span>
                                    <a class="line" title="已过人员" onclick="baneCountManager.DatedCount();">已过人员：(@ViewBag.PastCount) 人</a>
                                </li>
                            }
                        }
                        @{
                            var data = ViewBag.DBSY;
                            if (data != null)
                            {
                                for (int i = 0; i < data.Count; i++)
                                {
                                    <li class="list-group-item">
                                        @if (data[i].to_title.ToString().Length > 15)
                                        {
                                            <span class="badge badge-primary"></span><a class="line" title="@data[i].to_title" onclick="BMQDocument.Todo('@data[i].to_id');">@data[i].to_title.Substring(0, 12)...</a><code class="pull-right">@data[i].to_send_user_name@data[i].to_send_date.ToString("MM/dd")</code>
                                        }
                                        else
                                        {
                                            <span class="badge badge-primary"></span><a class="line" title="@data[i].to_title" onclick="BMQDocument.Todo('@data[i].to_id');">@data[i].to_title</a><code class="pull-right">@data[i].to_send_user_name@data[i].to_send_date.ToString("MM/dd")</code>
                                        }
                                    </li>
                                    if (i > 3)
                                    {
                                        break;
                                    }
                                }
                            }
                            else
                            {
                                <li class="list-group-item">
                                    <span class="badge badge-primary"></span><a class="line"> 目前没有待办事宜 </a>
                                </li>
                            }
                        }
                        <li class="list-group-item">

                        </li>
                    </ul>
                </div>
            </div>
        </div>
        <div class="col-sm-4">
            <div class="ibox float-e-margins">
                <div class="ibox-title">
                    <h5>政策</h5>
                    <div class="ibox-tools">
                        <span><a class="line">更多</a></span>
                    </div>
                </div>
                <div class="ibox-content no-padding">
                    <ul class="list-group">
                        @{
                            if (ViewBag.Polity != null && ViewBag.Polity.Count>0)
                            {
                                foreach (var item in ViewBag.Polity)
                                {
                                    <li class="list-group-item">
                                        <span class="badge badge-danger"></span> <a href="#" onclick="BMQDocument.Mess('@item.m_id')">(@item.m_type)@item.m_title</a>
                                    </li>
                                }
                            }
                            else
                            {
                                <li class="list-group-item">
                                    <span class="badge badge-danger"></span> <a href="#" style="color:darkgrey;">还未发布政策</a>
                                </li>
                            }
                        }
                        
                        @*@for (int i = 0; i < ViewBag.BMQ.Count; i++)
                        {
                            if (i < 4)
                            {
                        <li class="list-group-item">
                            <span class="badge badge-primary"></span><a class="line" onclick="BMQDocument.Detail('@ViewBag.BMQ[i].DocID');">
                                @ViewBag.BMQ[i].DocTitle
                            </a>
                        </li>
                            }
                            else
                            {
                                break;
                            }
                        }*@
                        <li class="list-group-item">

                        </li>
                    </ul>
                </div>
            </div>
        </div>
        <div class="col-sm-4">
            <div class="ibox float-e-margins">
                <div class="ibox-title">
                    <h5>新闻公告</h5>
                    <div class="ibox-tools">
                        <span><a href="#v119" class="line">更多</a></span>
                    </div>
                </div>
                <div class="ibox-content no-padding">
                    <ul class="list-group">
                        @{
                            if (ViewBag.Mess != null && ViewBag.Mess.Count > 0)
                            {
                                foreach (var item in ViewBag.Mess)
                                {
                                <li class="list-group-item">
                                    <span class="badge badge-danger"></span> <a href="#" onclick="BMQDocument.Mess('@item.m_id')">(@item.m_type)@item.m_title</a>
                                </li>
                                }
                            }
                            else
                            {
                                <li class="list-group-item">
                                    <span class="badge badge-danger"></span> <a href="#" style="color:darkgrey;">还未发布新闻公告</a>
                                </li>
                            }
                        }
                        <li class="list-group-item">

                        </li>
                    </ul>
                </div>
            </div>
        </div>
    </div>
</div>
@section footSection{
    @Scripts.Render("~/bundles/mainScript")
    @Scripts.Render("~/bundles/echarts")
    <script src="~/Resources/businessScript/Statistics/DebtItem.js"></script>
    <script src="~/Scripts/url-help.js"></script>
    <script src="~/Resources/layer-3.0.1/layer.js"></script>
    <script>
        $(function () {
        });
        //弹窗
        var BMQDocument = {

            //政策信息
            Detail: function (documentID) {
                var index = layer.open({
                    type: 2,
                    title: "政策详细信息",
                    content: $.GetIISName() + "/Index/DocumentDetail?documentID=" + documentID,
                    area: ["850px", "400px"],
                    maxmin: true
                });
            },

            //待办事宜
            Todo: function (to_id) {
                var index = layer.open({
                    type: 2,
                    title: "待办事宜",
                    content: $.GetIISName() + "/Todo/TodoDetail?to_id=" + to_id,
                    area: ["850px", "400px"],
                    maxmin: true
                });
            },

            Mess:function(m_id){
                var index = layer.open({
                    type: 2,
                    title: "新闻公告",
                    content: $.GetIISName() + "/NewsMessage/NewsDetail?mess_id=" + m_id,
                    area: ["850px", "400px"],
                    maxmin: true
                });
            }
        }
        //首页统计
        var baneCountManager = {
            //即将过检
            WeekCount:function(){
                window.parent.main_openWindowByLink({
                    url: ctx + '/BaneProUser/ProUserList?queryType=should&queryDay=-7&baneTask=all',
                    height: "95%",
                    width: "90%",
                    title: "即将过检人员"
                });
            },
            //社区数量
            VillagesCount: function(){

            },
            //总人数
            PersonCount:function(){
                window.parent.main_openWindowByLink({
                    url: ctx + '/BaneUser/UserList',
                    height: "95%",
                    width: "90%",
                    title: "总人数"
                });
            },
            //本月应检人数
            MonthCount: function () {
                window.parent.main_openWindowByLink({
                    url: ctx + '/BaneProUser/ProUserList?queryType=should&queryDay=30&baneTask=all',
                    height: "95%",
                    width: "90%",
                    title: "本月应检人数"
                });
            },
            //本月已检人数
            FinishCount: function () {
                window.parent.main_openWindowByLink({
                    url: ctx + '/BaneProUser/ProUserList?queryType=finish&queryDay=-30&baneTask=all',
                    height: "95%",
                    width: "90%",
                    title: "本月已检人数"
                });
            },
            //过检人数
            DatedCount: function () {
                window.parent.main_openWindowByLink({
                    url: ctx + '/BaneProUser/ProUserList?queryType=dated&queryDay=0&baneTask=all',
                    height: "95%",
                    width: "90%",
                    title: "过检人数"
                });
            }
        }
    </script>
}